<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>档案信息</title>
    <script src="../../../../res/js/jquery-3.4.1.min.js" charset="utf-8"></script>
    <script src="../../../../res/js/login_common.js" charset="utf-8"></script>
    <script src="../../../../res/layui/layui.js" charset="utf-8"></script>
    <script src="../../../../res/js/Tools.js" charset="utf-8"></script>
    <link rel="shortcut icon" type="image/x-icon" href="../../../../res/images/favicon.ico">
    <link rel="stylesheet" href="../../../../res/layui/css/layui.css" media="all">
</head>
<body>
<div>
    <div class="layui-form-item layui-form-text">
        <div class="layui-input-block" id="oaEntryEducations">
            <fieldset class="layui-elem-field">
                <legend>
                    教育经历
                </legend>
                <div class="layui-field-box">
                    <table class="layui-table" id="oaEntryEducation"
                           lay-filter="oaEntryEducation">
                    </table>
                </div>
            </fieldset>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <div class="layui-input-block" id="oaEntryWorks">
            <fieldset class="layui-elem-field">
                <legend>
                    工作经历
                </legend>
                <div class="layui-field-box">
                    <table class="layui-table" id="oaEntryWork"
                           lay-filter="oaEntryWork">

                    </table>
                </div>
            </fieldset>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <div class="layui-input-block" id="oaEntryTrains">
            <fieldset class="layui-elem-field">
                <legend>
                    培训经历
                </legend>
                <div class="layui-field-box">
                    <table class="layui-table" id="oaEntryTrain"
                           lay-filter="oaEntryTrain">
                    </table>
                </div>
            </fieldset>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <div class="layui-input-block" id="oaEntryFamilys">
            <fieldset class="layui-elem-field">
                <legend>
                    家庭成员
                </legend>
                <div class="layui-field-box">
                    <table class="layui-table" id="oaEntryFamily"
                           lay-filter="oaEntryFamily">
                    </table>
                </div>
            </fieldset>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <div class="layui-input-block" id="oaEmergencyContacts">
            <fieldset class="layui-elem-field">
                <legend>
                    紧急联络人
                </legend>
                <div class="layui-field-box">
                    <table class="layui-table" id="oaEmergencyContact"
                           lay-filter="oaEmergencyContact">

                    </table>
                </div>
            </fieldset>
        </div>
    </div>
</div>
<script>
    let oaEntryEducationTable; // 教育经历
    let oaEntryWorkTable; //工作经历
    let oaEntryTrainTable; //培训经历
    let oaEntryFamilyTable; // 家庭成员
    let oaEmergencyContactTable; // 紧急联络人
    layui.use(['form', 'laydate', 'table'], function () {
        var table = layui.table;
        var form = layui.form
            , layer = layui.layer
            , laydate = layui.laydate;
        let res=getAjaxById(getRootPath()+"oaEntryFlowAction/getThisRecord");
        if(res){
            oaEntryEducationTable = table.render({
                elem: '#oaEntryEducation'
                , url: getRootPath() + 'oaEntryEducation/selectAll?entryId=' + res
                , headers: {token: token}
                , title: '教育经历'
                , parseData: function (res) {
                    if (res.code === 500) {
                        return false
                    }
                    return {
                        "code": res.data.code,
                        "msg": res.data.msg,
                        "count": res.data.count,
                        "data": res.data.data
                    };
                }
                , cols: [[
                    {type: 'numbers', title: '序列', fixed: 'left', width: 120}
                    , {
                        field: 'startTime', title: '开始时间', templet: function (row) {
                            if (row.startTime) {
                                return dateFormat("yyyy-MM-dd", new Date(row.startTime));
                            } else {
                                return "";
                            }
                        }, width: 120
                    }
                    , {
                        field: 'endTime', title: '结束时间', templet: function (row) {
                            if (row.endTime) {
                                return dateFormat("yyyy-MM-dd", new Date(row.endTime));
                            } else {
                                return "";
                            }
                        }, width: 120
                    }
                    , {field: 'educationSchool', title: '院校名称', width: 120}
                    , {field: 'educationDegreeName', title: '学历', width: 120}
                    , {field: 'educationMajor', title: '专业', width: 120}
                    , {field: 'educationSeries', title: '证书', width: 120}
                ]]
            });

            oaEntryWorkTable = table.render({
                elem: '#oaEntryWork'
                , url: getRootPath() + 'oaEntryWork/selectAll?entryId=' + res
                , headers: {token: token}
                , title: '工作经历'
                , parseData: function (res) {
                    if (res.code === 500) {
                        return false
                    }
                    return {
                        "code": res.data.code,
                        "msg": res.data.msg,
                        "count": res.data.count,
                        "data": res.data.data
                    };
                }
                , cols: [[
                    {type: 'numbers', title: '序列', fixed: 'left'}
                    , {
                        field: 'startTime', title: '开始时间', templet: function (row) {
                            if (row.startTime) {
                                return dateFormat("yyyy-MM-dd", new Date(row.startTime));
                            } else {
                                return "";
                            }
                        }
                    }
                    , {
                        field: 'endTime', title: '结束时间', templet: function (row) {
                            if (row.endTime) {
                                return dateFormat("yyyy-MM-dd", new Date(row.endTime));
                            } else {
                                return "";
                            }
                        }
                    }
                    , {field: 'workUnit', title: '工作单位'}
                    , {field: 'workPost', title: '职位'}
                    , {field: 'voucher', title: '证明人姓名'}
                    , {field: 'phone', title: '证明人电话'}
                    , {field: 'reasonsForLeaving', title: '离职原因'}
                ]]
            });

            oaEntryTrainTable = table.render({
                elem: '#oaEntryTrain'
                , url: getRootPath() + 'oaEntryTrain/selectAll?entryId=' + res
                , headers: {token: token}
                , title: '培训经历'
                , parseData: function (res) {
                    if (res.code === 500) {
                        return false
                    }
                    return {
                        "code": res.data.code,
                        "msg": res.data.msg,
                        "count": res.data.count,
                        "data": res.data.data
                    };
                }
                , cols: [[
                    {type: 'numbers', title: '序列', fixed: 'left'}
                    , {
                        field: 'startTime', title: '开始时间', templet: function (row) {
                            if (row.startTime) {
                                return dateFormat("yyyy-MM-dd", new Date(row.startTime));
                            } else {
                                return "";
                            }
                        }
                    }
                    , {
                        field: 'endTime', title: '结束时间', templet: function (row) {
                            if (row.endTime) {
                                return dateFormat("yyyy-MM-dd", new Date(row.endTime));
                            } else {
                                return "";
                            }
                        }
                    }
                    , {field: 'trainContent', title: '培训内容'}
                    , {field: 'trainInstitutional', title: '培训组织机构'}
                    , {field: 'trainResult', title: '培训结果'}
                ]]
            });

            oaEntryFamilyTable=table.render({
                elem: '#oaEntryFamily'
                , url: getRootPath() + 'oaEntryFamily/selectAll?entryId='+res
                , headers: {token: token}
                , title: '家庭成员'
                , parseData: function (res) {
                    if (res.code === 500) {
                        return false
                    }
                    return {
                        "code": res.data.code,
                        "msg": res.data.msg,
                        "count": res.data.count,
                        "data": res.data.data
                    };
                }
                , cols: [[
                    {type: 'numbers', title: '序列', fixed: 'left'}
                    , {field: 'familyName', title: '姓名'}
                    , {field: 'relation', title: '关系'}
                    , {field: 'familyEmployer', title: '工作单位'}
                    , {field: 'post', title: '所在岗位及职务'}
                ]]
            });

            oaEmergencyContactTable=table.render({
                elem: '#oaEmergencyContact'
                , url: getRootPath() + 'oaEmergencyContact/selectAll?entryId='+res
                , headers: {token: token}
                , title: '紧急联络人'
                , parseData: function (res) {
                    if (res.code === 500) {
                        return false
                    }
                    return {
                        "code": res.data.code,
                        "msg": res.data.msg,
                        "count": res.data.count,
                        "data": res.data.data
                    };
                }
                , cols: [[
                    {type: 'numbers', title: '序列', fixed: 'left'}
                    , {field: 'emergencyContactName', title: '姓名'}
                    , {field: 'relation', title: '关系'}
                    , {field: 'emergencyContactAddress', title: '联系地址'}
                    , {field: 'emergencyContactPostcode', title: '联系邮编'}
                    , {field: 'emergencyContactPhone', title: '电话'}
                ]]
            });
        }else{
            layer.alert('你暂无档案', {
                icon: 2,closeBtn: 0
            }, function(){
                formClose();
                parent.layui.table.reload('test');//刷新父页面
                const index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                parent.layer.close(index);
            });
        }


    });
</script>
</body>
</html>